package com.e3.basdoc.tax.service;

import java.util.List;

import com.e3.basdoc.tax.model.TaxModel;
import com.e3.core.base.ServiceLocator;
import com.e3.core.cache.CacheLoader;

public class TaxCacheLoader implements CacheLoader {
	
	private TaxQueryService currencyQueryService;
	
	private TaxQueryService getTaxQueryService(){
		if(currencyQueryService == null){
			currencyQueryService = ServiceLocator.getQueryService(TaxQueryService.class);
		}
		return currencyQueryService;
	}

	public void loadeData() throws Exception {
		List<TaxModel> models = getTaxQueryService().getAllTaxs();
		if(models==null||models.isEmpty()){
			return;
		}
		for (TaxModel model : models) {
			TaxCacheManager.INSTANCE.put(model);
		}

	}

}
